// pages/cloudStorage/index/index.ts
Page({
  data: {
    status: {
      used: 7.9,
      total: 10,
      rest: 2.1,
      unit: 'GB',
      expiration: '2025/8/25',
      info: '空间不足，会影响视频存储',
      percentage: 0,
    },
    deviceList: [
      { id: 0, name: '翻斗花园牛爷爷', used: 2.1, unit: 'GB' },
      { id: 1, name: '翻斗花园牛胡图图', used: 3.3, unit: 'GB' }
    ]
  },
  onLoad() {
    this.calcPercentage()
  },
  calcPercentage() {
    let percentage = 0;
    percentage = (this.data.status.used / this.data.status.total) * 100 + '%'
    this.setData({ 'status.percentage': percentage })
  },
  delet() {
    // 直接调用组件方法（需获取实例）
    const alert = this.selectComponent('#v-alert')
    alert.toggleAlert()
  },
  add() {
    // 直接调用组件方法（需获取实例）
    const alert = this.selectComponent('#v-drawer')
    alert.toggleDrawer()
  },
})